<%@ page contentType="text/html; charset=utf-8" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%String skin = (String) session.getAttribute("USERSKIN_SESSION");%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">

<head>
    <meta charset="utf-8" />
    <%--<meta name="viewport" content="width=device-width, initial-scale=1.0" />--%>
    <title>山西省审计厅档案综合管理系统</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <jsp:include page="/inc/head.jsp" flush="true" />
    <jsp:include page="/inc/footer.jsp" flush="true" />
    <script src="${basePath}/js/devPublic.js"></script>
    <script src="${basePath }/js/tip.js"></script>
</head>
<style>
    * {
        margin: 0;
        padding: 0
    }

    .tablestyle tr {
        width: 100%
    }

    .tablestyle td {
        font-size: 13px;
        height: 40px;
    }

    .tablestyle .content {
        padding-left: 20px;
    }

    .tablestyle select {
        width: 130px;
        height: 34px;
    }

    .tablestyle input {
        border: 1px solid #ccc;
        border-radius: 3px;
        width: 130px;
    }

    .content #rowToolBar .box-info {
        margin-bottom: 0;
        border-top: 0;
        box-shadow:none;
    }

    #JudSearchForm #arcApartmentSearch .select2-selection {
        border-color: #ccc;
    }

    #JudSearchForm #judTitleSearch {
        width: 130px !important;
    }
    #searchScopeGroup .form-group {
        margin-top: 0!important;
        margin-bottom: 0 !important;
    }
    .content #rowToolBar .box-info  .box-body {
        padding: 0;
        margin-bottom: 10px;
        line-height: 28px;
    }
    .content #rowToolBar .box-info  .box-body #searchScopeGroup label {
        margin-bottom:0;
    }
    .content input,.content select {
        height: 28px !important;
        padding: 0 0 0 0!important;
    }
    .content input {
        padding: 0 0 0 5px!important;
    }
    .content h3 {
        font-size: 14px;
    }
    #JudSearchForm .tablestyle .content,#itemMessageSearchDiv #ItemSearchForm .content,#sinItemMessageSearchDiv #sinItemSearchForm .tablestyle .content{
        text-align: right;
        padding-right: 8px;
    }

    .tablestyle .form-group .select2-container--default .select2-selection--single, .select2-selection .select2-selection--single {
        padding: 6px 0;
        font-size: 14px;
    }
    .tablestyle .form-group .select2-container .select2-selection--single .select2-selection__rendered {
        padding-left: 5px;
        margin-top: -6px;
        font-size: 14px;
    }

</style>

<body class="hold-transition skin-blue sidebar-mini">
    <input type="hidden" id="userRole" name="userRole" value="0">
    <!-- Main content -->
    <section class="content">
        <!-- /rowToolBar -->
        <div id="rowToolBar" class="row" style="height: 100%;">
            <div class="col-xs-12">
                <div class="box box-info">
                    <form class="form-horizontal">
                        <!-- /.box-header -->
                        <div class="box-body">
                            <div id="searchScopeGroup">
                                <div class="form-group"
                                    style="float: left ;margin-right: 30px;margin-top: 15px;margin-bottom: 5px;margin-left: 8px;">
                                    <label>检索范围：</label>
                                </div>
                                <div class="form-group"
                                    style="float: left;margin-right: 30px;margin-top: 10px;margin-bottom: 5px">
                                    <select class="form-control" id="searchScope" onchange="searchScopeAction()">
                                        <option value="1">卷</option>
                                        <option value="2">卷内件</option>
                                        <option value="3">单件</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <!-- /.box-body -->
                    </form>
                    <!-- /.form -->
                </div>
                <!-- /.box -->
            </div>
            <!-- /.col-xs-12 -->
        </div>

        <div class="content-search" style="height: 100%">
            <div id="allContentASearchDiv" class="panel panel-default" style="height: 20%;display: none">
                <div class="panel-heading">
                    <h3 class="panel-title">检索方式——全文检索</h3>
                </div>
                <div class="panel-body">
                    <form id="ItemForm" class="form-horizontal form-bordered form-row-strippe" data-toggle="validator"
                        method="post">
                        <table style="width: 100%" id="archiveItemTable" class="tablestyle">
                            <tr>
                                <td class="content" style="width: 150px">
                                    请输入检索信息：
                                </td>
                                <td class="form-group" style="width: 450px">
                                    <input type="text" id='arcSearchMessage' name='volCatalog' value=''
                                        style="width: 400px" />
                                </td>
                                <td class="form-group">
                                    <button onclick="searchall()">检索</button>
                                </td>
                            </tr>
                        </table>
                    </form>
                </div>
            </div>
            <div id="judMessageSearchDiv" class="panel panel-default" style="height: 30%;display: none">
                <div class="panel-heading">卷信息</div>
                <div class="panel-body">
                    <form id="JudSearchForm" class="form-horizontal form-bordered form-row-strippe"
                        data-toggle="validator" method="post">
                        <table style="width: 100%" id="archiveJudSearchTable" class="tablestyle">
                            <tr>
                                <td class="content">
                                    案&nbsp;卷&nbsp;类&nbsp;型
                                </td>
                                <td class="form-group">
                                    <select id="arcTypeSearch" class="arcTypeSearch form-control" name="volSecret"
                                        style="height: 34px;">
                                    </select>
                                </td>
                                <td class="content">
                                    保&nbsp;管&nbsp;期&nbsp;限
                                </td>
                                <td class="form-group">
                                    <select id="arcDeadlineSearch" class="storageTimeSinSearch form-control"
                                        name="volSecret" style="height: 34px;">
                                    </select>
                                </td>
                                <td class="content">
                                    案&nbsp;&nbsp;&nbsp;卷&nbsp;&nbsp;&nbsp;号
                                </td>
                                <td class="form-group">
                                    <input class="form-control" type="text" id='arcNumberSearch' name='volCatalog'
                                        value='' />
                                </td>
                                <td class="content">
                                    归&nbsp;档&nbsp;年&nbsp;度
                                </td>
                                <td class="form-group">
                                    <input type="text" id='arcYearSearch' class="form-control" name='volCatalog'
                                        value='' />
                                </td>
                                <td class="content">
                                    案&nbsp;卷&nbsp;题&nbsp;名
                                </td>
                                <td class="form-group">
                                    <input type="text" id='judTitleSearch' class="form-control" name='volCatalog'
                                        value='' style="width: 400px" />
                                </td>
                            </tr>
                            <tr>
                                <td class="content">
                                    档&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;号
                                </td>
                                <td class="form-group">
                                    <input type="text" id='judNumSearch' class="form-control" name='volFilingDate'
                                        onfocus="WdatePicker()" />
                                </td>
                                <td class="content">
                                    归&nbsp;档&nbsp;单&nbsp;位
                                </td>
                                <td class="form-group">
                                    <select type="text" id='arcApartmentSearch' class="form-control" name='volCatalog'
                                        style="height: 34px;" value=''></select>
                                </td>
                                <td class="content">
                                    审&nbsp;计&nbsp;组&nbsp;长
                                </td>
                                <td class="form-group">
                                    <input type="text" id='auditPersosnSearch' class="form-control" name='volCatalog'
                                        value='' />
                                </td>
                                <td class="content">
                                    密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;级
                                </td>
                                <td class="form-group">
                                    <select type="text" id='secretLevelSearch' class="form-control" name='volCatalog'
                                        value=''></select>
                                </td>
                                <td class="content">
                                    审计起止日期
                                </td>
                                <td class="form-group">
                                    <input type="text" id='auditDateSearch' class="form-control" name='volFilingDate'
                                        onfocus="WdatePicker()" />
                                </td>
                            </tr>
                        </table>
                        <div style="float: right">
                            <button type="button" class="btn btn-default" id="clearJudMessage"
                                onclick="clearJudMessaegAction()">清空</button>
                            <button type="button" class="btn btn-primary" id="searchJudMessage"
                                onclick="searchJudMessageAction()">检索</button>
                        </div>
                    </form>
                </div>
            </div>
            <div id="itemMessageSearchDiv" class="panel panel-default" style="height: 30%;display: none">
                <div class="panel-heading">件信息</div>
                <div class="panel-body">
                    <form id="ItemSearchForm" class="form-horizontal form-bordered form-row-strippe"
                        data-toggle="validator" method="post">
                        <table style="width: 100%" id="archiveItemSearchTable" class="tablestyle">
                            <tr>
                                <td class="content">
                                    单&nbsp;&nbsp;&nbsp;元&nbsp;&nbsp;&nbsp;号
                                </td>
                                <td class="form-group">
                                    <input type="text" id='partNumberSearch' name='volCatalog' value='' />
                                </td>
                                <td class="content">
                                    发&nbsp;文&nbsp;日&nbsp;期
                                </td>
                                <td class="form-group">
                                    <input type="text" id='itemStartDateSearch' name='volCatalog' value='' />
                                </td>
                                <td class="content">
                                    题&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名
                                </td>
                                <td class="form-group">
                                    <input type="text" id='itemTitleSearch' name='volCatalog' value=''
                                        style="width: 400px" />
                                </td>
                            </tr>
                            <tr>
                                <td class="content">
                                    文&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;号
                                </td>
                                <td class="form-group">
                                    <input type="text" id='itemFileNumberSearch' name='volCatalog' value='' />
                                </td>

                                <td class="content">
                                    责&nbsp;&nbsp;&nbsp;任&nbsp;&nbsp;&nbsp;者
                                </td>
                                <td class="form-group">
                                    <input type="text" id='dutyPersonSearch' name='volCatalog' value='' />
                                </td>
                                <td class="content">
                                    密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;级
                                </td>
                                <td class="form-group">
                                    <select type="text" id='itemSecretLevelSearch' name='volCatalog' value=''></select>
                                </td>
                            </tr>
                        </table>
                        <div style="float: right">
                            <button type="button" class="btn btn-default" id="clearItemMessage" onclick="clearItemMessageAction()">清空</button>
                            <button type="button" class="btn btn-primary" id="searchItemMessage" onclick="searchItemMessageAction()">检索</button>
                        </div>
                    </form>
                </div>
            </div>

            <div id="sinItemMessageSearchDiv" class="panel panel-default" style="height: 30%;display: none">
                <div class="panel-heading">单件信息</div>
                <div class="panel-body">
                    <form id="sinItemSearchForm" class="form-horizontal form-bordered form-row-strippe"
                        data-toggle="validator" method="post">
                        <table style="width: 100%" id="archiveSinItemSearchTable" class="tablestyle">
                            <tr>
                                <td class="content">
                                    单&nbsp;&nbsp;&nbsp;元&nbsp;&nbsp;&nbsp;号
                                </td>
                                <td class="form-group">
                                    <input type="text" id='partSinNumberSearch' name='volCatalog' placeholder="必填项"
                                        value='' />
                                </td>
                                <td class="content">
                                    文&nbsp;件&nbsp;类&nbsp;型
                                </td>
                                <td class="form-group">
                                    <select id="itemTypeSinSearch" class="arcTypeSearch" name="volSecret"
                                        style="height: 34px;">
                                    </select>
                                </td>
                                <td class="content">
                                    保&nbsp;管&nbsp;期&nbsp;限
                                </td>
                                <td class="form-group">
                                    <select id="storageTimeSinSearch" class="storageTimeSinSearch" name="volSecret"
                                        style="height: 34px;">
                                    </select>
                                </td>
                                <td class="content">
                                    题&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名
                                </td>
                                <td class="form-group">
                                    <input type="text" id='itemSinTitleSearch' name='volCatalog' placeholder="必填项"
                                        value='' style="width: 400px" />
                                </td>
                            </tr>
                            <tr>
                                <td class="content">
                                    件&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;号
                                </td>
                                <td class="form-group">
                                    <input type="text" id='itemSinFileNumberSearch' name='volCatalog' placeholder="必填项"
                                        value='' />
                                </td>
                                <td class="content">
                                    发&nbsp;文&nbsp;日&nbsp;期
                                </td>
                                <td class="form-group">
                                    <input type="text" id='itemSinStartDateSearch' name='volCatalog' placeholder="必填项"
                                        value='' />
                                </td>
                                <td class="content">
                                    密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;级
                                </td>
                                <td class="form-group">
                                    <input type="text" id='itemSecretSinLevelSearch' name='volCatalog' placeholder="必填项"
                                        value='' />
                                </td>
                                <td class="content">
                                    归&nbsp;档&nbsp;年&nbsp;度
                                </td>
                                <td class="form-group">
                                    <input type="text" id='itemArchiveDateSinSearch' name='volCatalog' placeholder="必填项"
                                        value='' />
                                </td>
                            </tr>
                        </table>
                        <div style="float: right">
                            <button type="button" class="btn btn-default" id="clearItemSinMessage"
                                onclick="clearItemSinMessageAction()">清空</button>
                            <button type="button" class="btn btn-primary" id="searchItemSinMessage"
                                onclick="searchItemSinMessageAction()">检索</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        </div>
        <div class="panel panel-default" id="dataMsg">
            <div class="panel-heading">
                <h3 class="panel-title">数据信息</h3>
            </div>
            <div class="table-left">
                <table id="table">
                </table>
            </div>
        </div>
        </div>
    </section>
    <jsp:include page="/WEB-INF/jsp/searchArchive/viewfileArchive.jsp" flush="true" />
    <jsp:include page="/WEB-INF/jsp/preArchive/viewOriginal.jsp" flush="true" />
    <script>
        var $table = $('#table');
        var urlFile;
        function userManagerAction(urla, columns) {
            $table.bootstrapTable({
                url: urla,
                striped: true,
                //search: false,
                //showRefresh: false,
                //showColumns: false,
                minimumCountColumns: 2,
                clickToSelect: true,//是否启用点击选中行
                singleSelect: true,
                detailView: false,
                detailFormatter: 'detailFormatter',
                pagination: true,
                pageSize: 50,
                pageList: [50, 100],
                smartDisplay: false,
                paginationLoop: true,
                sidePagination: 'server',
                silentSort: false,
                escape: true,
                searchOnEnterKey: true,
                maintainSelected: true,
                columns: columns
            });
        }
        var judColumn = [
            { field: 'ck', checkbox: true },
            { field: 'volClass', title: '案卷类型', sortable: true, align: 'center', formatter: 'arcClassSinFormatter' },
            { field: 'volTitle', title: '题名', align: 'center' },
            { field: 'volStorageTime', title: '保管期限', formatter: 'storageTimeFormatter' },
            { field: 'volCaseNum', title: '档号', align: 'center' },
            { field: 'volArchiveUnit', title: '归档单位', formatter: 'orgIdConversionNameFormatter' },
            { field: 'volAuditLeader', title: '审计组长', sortable: true, align: 'center' },
            { field: 'volSecret', title: '密级', align: 'center', formatter: 'secretLevelFormatter' },
            { field: 'volStatus', title: '档案状态', align: 'center', formatter: 'statusFormatter' },
            { field: 'volArchiveYear', title: '归档年度', align: 'center' },
            { field: 'volArchiveDate', title: '归档日期', align: 'center', formatter: 'timeFormatter' },
            { field: 'action', title: '操作', align: 'center', formatter: 'volumeActionFormatter', events: 'actionEvents', clickToSelect: true }
        ]
        var itemColumns = [
            { field: 'ck', checkbox: true },
            { field: 'itemTemporary', title: '单元号', align: 'center' },
            { field: 'itemTitle', title: '题名', align: 'center' },
            { field: 'itemCreateTime', title: '发文日期', align: 'center' },
            { field: 'itemName', title: '文号', align: 'center' },
            { field: 'itemRespons', title: '责任者', align: 'center' },
            { field: 'itemSecret', title: '密级', align: 'center', formatter: 'secretLevelFormatter' },
            { field: 'itemStatus', title: '档案状态', formatter: 'statusFormatter' },
            { field: 'itemStr11Date', title: '归档日期', align: 'center', formatter: 'timeFormatter' },
            { field: 'action', title: '操作', align: 'center', formatter: 'itemActionFormatter', events: 'actionEvents', clickToSelect: false }
        ]
        var itemSinColumns = [
            { field: 'ck', checkbox: true },
            { field: 'itemExp1', title: '文件类型', align: 'center', formatter: 'arcClassSinFormatter' },
            { field: 'itemTemporary', title: '单元号', align: 'center' },
            { field: 'itemStr1', title: '件号', align: 'center' },
            { field: 'itemTitle', title: '题名', align: 'center' },
            { field: 'itemCreateTime', title: '发文日期', align: 'center' },
            { field: 'itemNum', title: '保管期限', align: 'center', formatter: 'storageTimeFormatter' },
            { field: 'itemName', title: '文号', align: 'center' },
            { field: 'itemRespons', title: '责任者', align: 'center' },
            { field: 'itemSecret', title: '密级', align: 'center', formatter: 'secretLevelFormatter' },
            { field: 'itemStatus', title: '档案状态', formatter: 'statusFormatter' },
            { field: 'itemStr1Date', title: '归档日期', align: 'center', formatter: 'timeFormatter' },
            { field: 'action', title: '操作', align: 'center', formatter: 'sinItemActionFormatter', events: 'actionEvents', clickToSelect: false }
        ]
        //格式化文件类型
        function arcClassSinFormatter(value, row, index) {
            return archiveType[value];
        }
        //格式化保管期限
        function storageTimeFormatter(value, row, index) {
            return storageTime[value];
        }
        //格式化密级
        function secretLevelFormatter(value, row, index) {
            return secretLevel[value];
        }
        //格式化归档单位
        function orgIdConversionNameFormatter(value, row, index) {
            return orgList[value];
        }
        /**
         *	状态显示按钮
         */
        function findSinTyByCode(value, row, index) {
            var styname = "";
            if (row.itemExp1 != "") {
                $.ajax({
                    type: 'POST',
                    url: '${basePath}/pcwindow/findArchiveTypeByArchiveNum',
                    dataType: "json",
                    data: {
                        volClass: row.itemExp1,
                    },
                    async: false,
                    success: function (data) {
                        if (data.length != 0) {
                            styname = data[0].sortName;
                        }
                    }
                });
                return styname;

            }
        }
        /**
         *	状态显示按钮
         */
        function findStByCode(value, row, index) {
            var stname = "";
            if (row.volStorageTime != "") {
                $.ajax({
                    type: 'POST',
                    url: '${basePath}/pcwindow/findStorageTimeTypeByCode',
                    dataType: "json",
                    data: {
                        volClass: row.volStorageTime,
                    },
                    async: false,
                    success: function (data) {
                        if (data.length != 0) {
                            stname = data[0].description;
                        }
                    }
                });
                return stname;
            }
        }
        /**
         *	状态显示按钮
         */
        function statusFormatter(value, row, index) {
            if (value == 0) {
                return '<font style="color:dodgerblue;">正常</font>'
            }
            if (value == 1) {
                return '<font style="color:grey;">鉴定中</font>'
            }
            if (value == 2) {
                return '<font style="color:grey;">借阅中</font>'
            }
        }
        /**
         *	格式化时间(格式YYYY-dd-MM HH:mm:ss)
         */
        function timeFormatter(value, row, index) {
            return formatshortDateTime(value);
        }
        /**
         *	卷操作按钮
         */
        function volumeActionFormatter(value, row, index) {
            if (row.volStatus == 0) {
                return '<a style="color:#01579b;" href="javascript:void(0)" onclick="archFileAction(' + row.volId + ')" >详情</a>&nbsp;&nbsp;&nbsp;' +
                    '<a style="color:#01579b;" href="javascript:void(0)" onclick="borrowJudVol(' + row.volId + ',0)">借阅</a>&nbsp;&nbsp;&nbsp;<shiro:hasPermission name="cms:commonsearch:appraisal"><a style="color:#01579b;" href="javascript:void(0)"  onclick="appraisalJudVol(' + row.volId + ',0)" >鉴定</a></shiro:hasPermission>';
            } else {
                return '<a style="color:#01579b;" href="javascript:void(0)" onclick="archFileAction(' + row.volId + ')" >详情</a>';
            }
        }

        /**
         *	件操作按钮
         */
        function itemActionFormatter(value, row, index) {
            var userRole = $("#userRole").val();
            if (row.itemStatus == 0) {
                if (userRole == 1) {
                    return '<a style="color:#01579b;" href="javascript:void(0)"  onclick="borrowJudVol(' + row.itemId + ',1)" >借阅</a>&nbsp;&nbsp;&nbsp;<shiro:hasPermission name="cms:commonsearch:appraisal"><a style="color:#01579b;" href="javascript:void(0)"  onclick="appraisalJudVol(' + row.itemId + ',1)" >鉴定</a></shiro:hasPermission>&nbsp;&nbsp;&nbsp;<shiro:hasPermission name="cms:commonsearch:essay"><a style="color:#01579b;" href="javascript:void(0)" onclick="detailAction(' + row.itemId + ',1)"  >查看原文</a></shiro:hasPermission>';
                } else {
                    return '<a style="color:#01579b;" href="javascript:void(0)"  onclick="borrowJudVol(' + row.itemId + ',1)" >借阅</a>';
                }
            } else {
                if (userRole == 1) {
                    return '<shiro:hasPermission name="cms:searchArc:essay"><a style="color:#01579b;" href="javascript:void(0)" onclick="detailAction(' + row.itemId + ',1)" >查看原文</a></shiro:hasPermission>';
                }
            }
        }
        /**
         *	件操作按钮
         */
        function sinItemActionFormatter(value, row, index) {
            var userRole = $("#userRole").val();
            if (row.itemStatus == 0) {
                if (userRole == 1) {
                    return '<shiro:hasPermission name="cms:commonsearch:essay"><a style="color:#01579b;" href="javascript:void(0)" onclick="detailAction(' + row.itemId + ',2)"  >查看原文</a></shiro:hasPermission>&nbsp;&nbsp;&nbsp;<a style="color:#01579b;" href="javascript:void(0)"  onclick="borrowJudVol(' + row.itemId + ',2)" >借阅</a>&nbsp;&nbsp;&nbsp;<shiro:hasPermission name="cms:commonsearch:appraisal"><a style="color:#01579b;" href="javascript:void(0)"  onclick="appraisalJudVol(' + row.itemId + ',2)" >鉴定</a></shiro:hasPermission>';
                } else {
                    return '<a style="color:#01579b;" href="javascript:void(0)"  onclick="borrowJudVol(' + row.itemId + ',2)" >借阅</a>';
                }
            } else {
                if (userRole == 1) {
                    return '<shiro:hasPermission name="cms:commonsearch:essay"><a style="color:#01579b;" href="javascript:void(0)" onclick="detailAction(' + row.itemId + '，2)" >查看原文</a></shiro:hasPermission>';
                }
            }
        }
        function clearItemSinMessageAction() {
            //清空件表单
            $("#sinItemSearchForm")[0].reset();
        }
        function clearItemMessageAction() {
            //清空件表单
            $("#ItemSearchForm")[0].reset();
        }
        function clearJudMessaegAction() {
            //清空卷表单
            $("#JudSearchForm")[0].reset();
            //清空件表单
            $("#ItemSearchForm")[0].reset();
            //重置选项框
            findAllJudType();
            findAllStorageTime();
            loadAllArcNumberAction();
            //加载密级
            findAllsecretLevelSin();
            //加载归档单位
            initSelectarcApartment();
            $("arcDeadlineSearch").find("option:selected").attr("selected", false);
        }
        function borrowJudVol(id, type) {
            window.location.href = '${basePath}/pcwindow/toBorrowArchive?id=' + id + '&type=' + type;
        }

        function appraisalJudVol(id, type) {
            window.location.href = '${basePath}/pcwindow/arcAppraisal?id=' + id + '&type=' + type;
        }

        $(function () {
            document.getElementById("judMessageSearchDiv").style.display = "";//显
            //加载全宗号
            loadAllArcNumberAction();
            //加载档案分类
            findAllJudType();
            //加载保管期限
            findAllStorageTime();
            //加载密级
            findAllsecretLevelSin();
            //加载归档单位
            initSelectarcApartment();
        })
        function searchScopeAction() {
            clearItemMessageAction();
            clearJudMessaegAction();
            var searchScope = $("#searchScope").val();
            if (searchScope == 1) {
                $("#judMessageSearchDiv").show();
                $("#itemMessageSearchDiv").hide();
                $("#sinItemMessageSearchDiv").hide();
                $("#searchJudMessage").show();
            } else if (searchScope == 3) {
                $("#sinItemMessageSearchDiv").show();
                $("#itemMessageSearchDiv").hide();
                $("#judMessageSearchDiv").hide();
            } else {
                $("#judMessageSearchDiv").show();
                $("#itemMessageSearchDiv").show();
                $("#searchJudMessage").hide();
                $("#sinItemMessageSearchDiv").hide();
            }
        }
        /**
         * 跳转原文页面
         */
        function detailAction(id,type) {
            var url = "";
            var data ={};
            if (id != "" && id != null) {
                if(type == 1){
                    url = "${basePath}/pcwindow/item/viewItemOriginal";
                    data = {id:id};
                }else{
                    url = "${basePath}/pcwindow/sin/viewSinItemOriginal";
                    data = {itemId:id};
                }
                $.ajax({
                    type: "post",
                    url: url,
                    data: data,
                    success: function (data) {
                        if (data != "failure") {
                            $('#openPdfModel').modal({
                                keyboard: true
                            });
                            var url = data;
                            var str = url.substr(url.length - 4, url.length - 1);
                            if (str == ".jpg" || str == ".png") {
                                var htmlImg = '<img src="' + url + '" style=" width:100%;height: 100%;" alt="预览">';
                                $("#pdfDialog").eq(0).append(htmlImg);
                            } else {
                                var options = {
                                    pdfOpenParams: {
                                        pagemode: "thumbs",
                                        navpanes: '0',
                                        /*toolbar: '0',*/ //去掉工具栏,打印,下载等,,,,
                                        statusbar: '0',
                                        view: 'FitV'
                                    }
                                };
                                var myPDF = PDFObject.embed(data, "#pdfDialog", options);
                            }
                        } else {
                            Ewin.alert("获取原文失败!");
                        }
                    },
                    error: function () {
                        Ewin.alert('加载错误,请联系管理员!');
                    }
                })
            } else {
                Ewin.alert('请选择数据!');
            }
        }

        //加载全宗号
        function loadAllArcNumberAction() {
            $.ajax({
                type: "POST",
                url: "${pageContext.request.contextPath }/manage/fonds/list",
                dataType: "json",
                async: false,
                success: function (data) {
                    if (data.length != 0) {
                        $("#allArcNumberSearch").val(data[0].fondsNum);
                    }
                }
            });
        }
        /**
         *	加载所有案卷类型
         */
        function findAllJudType() {
            $.ajax({
                type: "POST",
                url: "${pageContext.request.contextPath }/pcwindow/findAllJudType",
                dataType: "json",
                async: false,
                success: function (data) {
                    if (data.length != 0) {
                        var arcTypes = data.rows;
                        var str = '<option value="">请选择</option>';
                        for (var i = 0; i < arcTypes.length; i++) {
                            var tyname = arcTypes[i].sortName;
                            var tyid = arcTypes[i].sortNum;
                            str += '<option value="' + tyid + '">' + tyid + '-' + tyname + '</option>'
                        }
                        $(".arcTypeSearch").html(str);
                    }
                }
            });
        }
        /**
         *	加载所有保管期限
         */
        function findAllStorageTime() {
            $.ajax({
                type: "POST",
                url: "${pageContext.request.contextPath }/pcwindow/findAllStorageTime",
                dataType: "json",
                async: false,
                success: function (data) {
                    if (data.length != 0) {
                        var arcStorageTime = data.rows;
                        var str = '<option value="">请选择</option>';
                        for (var i = 0; i < arcStorageTime.length; i++) {
                            var tyname = arcStorageTime[i].description;
                            var tyid = arcStorageTime[i].code;
                            str += '<option value="' + tyid + '">' + tyname + '</option>'
                        }
                        $('.storageTimeSinSearch').html(str);
                    }
                }
            });
        }
        //卷检索
        function searchJudMessageAction() {
            selectLoginUserRole();
            $("#table").bootstrapTable('destroy');
            var volClass = $("#arcTypeSearch").find(":selected").val();//案卷类型
            var volStorageTime = $("#arcDeadlineSearch").find(":selected").val();//保管期限
            var volNo = $("#arcNumberSearch").val();//案卷号
            var volTitle = $("#judTitleSearch").val();//案卷题名
            var volArchiveYear = $("#arcYearSearch").val();//归档年度
            var volArchiveUnit = $("#arcApartmentSearch").val();//归档单位
            var volAuditLeader = $("#auditPersosnSearch").val();//审计组长
            var volSecret = $("#secretLevelSearch").val();//密级
            var volAuditDate = $("#auditDateSearch").val();//审计起止日期
            var volCaseNum = $("#judNumSearch").val();//档号
            var volume = {
                volClass: volClass,
                volStorageTime: volStorageTime,
                volNo: volNo,
                volTitle: volTitle,
                volArchiveYear: volArchiveYear,
                volArchiveUnit: volArchiveUnit,
                volAuditLeader: volAuditLeader,
                volSecret: volSecret,
                volAuditDate: volAuditDate,
                volCaseNum: volCaseNum,
            };
            var volumeArr = new Array();
            volumeArr.push(volume);
            var searchmodelTwo = JSON.stringify(volumeArr);
            var url = "${basePath}/pcwindow/searchJudMessage?searchmodelTwo=" + searchmodelTwo;
            userManagerAction(url, judColumn);
        }
        function searchItemSinMessageAction() {
            selectLoginUserRole();
            $("#table").bootstrapTable('destroy');
            var partSinNumberSearch = $("#partSinNumberSearch").val();//单元号
            var itemTypeSinSearch = $("#itemTypeSinSearch").val();//发文日期
            var storageTimeSinSearch = $("#storageTimeSinSearch").val();//题名
            var itemSinTitleSearch = $("#itemSinTitleSearch").val();//文号
            var itemSinFileNumberSearch = $("#itemSinFileNumberSearch").val();//责任者
            var itemSinStartDateSearch = $("#itemSinStartDateSearch").val();//密级
            var itemSecretSinLevelSearch = $("#itemSecretSinLevelSearch").val();//责任者
            var itemArchiveDateSinSearch = $("#itemArchiveDateSinSearch").val();//密级
            var itemSin = {
                itemTemporary: partSinNumberSearch,
                itemExp1: itemTypeSinSearch,
                itemNum: storageTimeSinSearch,
                itemTitle: itemSinTitleSearch,
                itemStr1: itemSinFileNumberSearch,
                itemCreateTime: itemSinStartDateSearch,
                itemSecret: itemSecretSinLevelSearch,
                itemExp3: itemArchiveDateSinSearch,
            };
            var itemArr = new Array();
            itemArr.push(itemSin);
            var searchmodelThree = JSON.stringify(itemArr);
            var url = "${basePath}/pcwindow/searchItemSinMessage?searchmodelThree=" + searchmodelThree;
            userManagerAction(url, itemSinColumns);
        }

        function searchItemAction() {
            selectLoginUserRole();
            $("#table").bootstrapTable('destroy');
            var itemTemporary = $("#partNumberSearch").val();//单元号
            var itemCreateTime = $("#itemStartDateSearch").val();//发文日期
            var itemTitle = $("#itemTitleSearch").val();//题名
            var itemName = $("#itemFileNumberSearch").val();//文号
            var itemRespons = $("#dutyPersonSearch").val();//责任者
            var itemSecret = $("#itemSecretLevelSearch").val();//密级
            var item = {
                itemTemporary: itemTemporary,
                itemCreateTime: itemCreateTime,
                itemName: itemName,
                itemRespons: itemRespons,
                itemTitle: itemTitle,
                itemSecret: itemSecret,
            };
            var itemArr = new Array();
            itemArr.push(item);
            var searchmodelOne = JSON.stringify(itemArr);
            var url = "${basePath}/pcwindow/searchItemMessage?searchmodelOne=" + searchmodelOne;
            userManagerAction(url, itemColumns);
        }
        //卷内件检索
        function searchItemMessageAction() {
            selectLoginUserRole();
            $("#table").bootstrapTable('destroy');
            //卷信息
            var volClass = $("#arcTypeSearch").find(":selected").val();//案卷类型
            var volStorageTime = $("#arcDeadlineSearch").find(":selected").val();//保管期限
            var volNo = $("#arcNumberSearch").val();//案卷号
            var volTitle = $("#judTitleSearch").val();//案卷题名
            var volArchiveYear = $("#arcYearSearch").val();//归档年度
            var volArchiveUnit = $("#arcApartmentSearch").val();//归档单位
            var volAuditLeader = $("#auditPersosnSearch").val();//审计组长
            var volSecret = $("#secretLevelSearch").val();//密级
            var volAuditDate = $("#auditDateSearch").val();//审计起止日期
            var volCaseNum = $("#judNumSearch").val();//档号
            var volume = {
                volClass: volClass,
                volStorageTime: volStorageTime,
                volNo: volNo,
                volTitle: volTitle,
                volArchiveYear: volArchiveYear,
                volArchiveUnit: volArchiveUnit,
                volAuditLeader: volAuditLeader,
                volSecret: volSecret,
                volAuditDate: volAuditDate,
                volCaseNum: volCaseNum,
            };
            var volumeArr = new Array();
            volumeArr.push(volume);
            var searchmodelTwo = JSON.stringify(volumeArr);
            //件信息
            var itemTemporary = $("#partNumberSearch").val();//单元号
            var itemCreateTime = $("#itemStartDateSearch").val();//发文日期
            var itemTitle = $("#itemTitleSearch").val();//题名
            var itemName = $("#itemFileNumberSearch").val();//文号
            var itemRespons = $("#dutyPersonSearch").val();//责任者
            var itemSecret = $("#itemSecretLevelSearch").val();//密级
            var item = {
                itemTemporary: itemTemporary,
                itemCreateTime: itemCreateTime,
                itemName: itemName,
                itemRespons: itemRespons,
                itemTitle: itemTitle,
                itemSecret: itemSecret,
            };
            var itemArr = new Array();
            itemArr.push(item);
            var searchmodelOne = JSON.stringify(itemArr);
            var url = "${basePath}/pcwindow/searchAllMessage?searchmodelOne=" + searchmodelOne + "&searchmodelTwo=" + searchmodelTwo;
            userManagerAction(url, itemColumns);
        }
        function selectLoginUserRole() {
            $.ajax({
                url: "${basePath}/pcwindow/selectLoginUserRole",
                type: "post",
                async: false,
                success: function (data) {
                    if (data.status == 200) {
                        $("#userRole").val(1);//单元号
                    }
                }
            })
        }
        //查看卷内件列表
        function archFileAction(volId) {
                var opt = {
                    url: '${basePath}/pcwindow/itemAndVolumeByVolId?volId='+volId,
                    silent: true,
                };
                $("#viewArchiveTable").bootstrapTable('refresh', opt);
                $('#viewArchiveModel').modal({
                keyboard: true
                });
        }
        //卷内件列表
        $("#viewArchiveTable").bootstrapTable({
            height: 440,
            striped: true,//是否显示行间隔色
            // search: false,//是否显示表格搜索，此搜索是客户端搜索，不会进服务端，所以，个人感觉意义不大
            showRefresh: false,//是否显示刷新按钮
            //showColumns: true,//是否显示所有的列
            minimumCountColumns: 2,//最少允许的列数
            clickToSelect: true,//是否启用点击选中行
            detailView: false,//是否显示父子表
            detailFormatter: 'detailFormatter',
            pagination: false,//是否显示分页（*）
            paginationLoop: false,
            sidePagination: 'server',//分页方式：client客户端分页，server服务端分页（*）
            silentSort: false,
            smartDisplay: false,
            escape: true,
            searchOnEnterKey: true,
            idField: 'itemId',
            maintainSelected: true,
            columns: [
                { field: 'ck', checkbox: true },
                { field: 'itemNum', title: '序号', align: 'center' },
                { field: 'itemPage', title: '页次', align: 'center' },
                { field: 'itemTemporary', title: '单元号', align: 'center' },
                { field: 'itemTitle', title: '题名', align: 'center' },
                { field: 'itemCreateTime', title: '发文日期', align: 'center' },
                { field: 'itemName', title: '文号', align: 'center' },
                { field: 'itemRespons', title: '责任者', align: 'center' },
                { field: 'itemSecret', title: '密级', align: 'center', formatter: 'secretLevelFormatter' },
                { field: 'itemStatus', title: '档案状态', formatter: 'statusFormatter' },
                { field: 'action', title: '操作', align: 'center', formatter: 'itemActionFormatter', events: 'actionEvents', clickToSelect: false }
            ]
        });

        /**
         * 加载所有密级
         */
        function findAllsecretLevelSin() {
            $.ajax({
                type: "POST",
                url: BASE_PATH + "/pcwindow/findAllSecretLevel",
                dataType: "json",
                async: false,
                success: function (data) {
                    if (data.length != 0) {
                        var findAllsecretLevel = data.rows;
                        var str = '<option value="">请选择</option>';
                        for (var i = 0; i < findAllsecretLevel.length; i++) {
                            var name = findAllsecretLevel[i].description;
                            var id = findAllsecretLevel[i].code;
                            str += '<option value="' + id + '">' + name + '</option>'
                        }
                        $('#secretLevelSearch').html(str);
                        $('#itemSecretLevelSearch').html(str);
                    }
                }
            });
        }
        /**
         * 加载归档单位
         */
        function initSelectarcApartment() {
            $.ajax({
                type: "POST",
                url: BASE_PATH + "/pcwindow/findAllOrg",
                dataType: "json",
                async: false,
                success: function (data) {
                    if (data.length != 0) {
                        initMaterialInput();
                        $('#arcApartmentSearch').select2({
                            placeholder: '请选择',
                            allowClear: true
                        });
                    }
                    var str ='<option value="">请选择</option>';
                    for (var i = 0; i < data.length; i++) {
                        var name = data[i].name;
                        var id = data[i].organizationId;
                        str += '<option value="' + id + '">' + name + '</option>'
                    }
                    $('#arcApartmentSearch').html(str);
                }
            });
        }
    </script>
</body>

</html>